<template lang="html">
  <div class="">
    <el-button type="button" name="button" @click='storeCountAddHandle(mapCount)'>storeConut</el-button>
    <span>{{ mapCount }}</span>
    <router-link to="/two">跳转组件2</router-link>
  </div>
</template>

<script>
import { mapState, mapActions } from 'vuex'
export default {
  name: 'One',
  computed: {
    // selfCount () {
    //   return this.$store.state.count
    // }
    ...mapState({
      mapCount: 'count'
    })
  },
  // data () {
  //   return {
  //     selfCount: this.$store.state.count
  //   }
  // },
  methods: {
    ...mapActions({
      mapChangeCount: 'changeCount'
    }),
    storeCountAddHandle (s) {
      // this.selfCount = this.selfCount + 1

      // this.$store.dispatch('changeCount', this.mapCount + 33  )
      // 映射过后不用写上面这句,改为下面这句就行
      this.mapChangeCount( this.mapCount + 9 )

      // 页面跳转
      this.$router.push('/two')
    }
  }
}
</script>

<style lang="css">
</style>
